<template>
  <div class="sysinfo_wrapper">
    <div class="title_wrapper">
      <el-input
        placeholder="请输入标题"
        v-model="title"
        clearable>
      </el-input>
    </div>
    <div class="content_wrapper">
      <el-input
        type="textarea"
        :autosize="{ minRows: 10, maxRows: 20}"
        placeholder="请输入内容"
        v-model="content">
      </el-input>
    </div>
    <div class="btn_wrapper">
        <el-button type="success" @click="pushInfo">发送系统通知</el-button>
    </div>
  </div>
</template>

<script>
import {myGet, myPostBody} from '../utils/api'
export default {
  data(){
    return {
      title: '', 
      content: '', 
    }
  }, 
  mounted(){

  },
  methods: {
    pushInfo(){
      myPostBody('/sys/info', {title: this.title, content: this.content}).then(res => {
        var myres = res.data.res
        if(res.data.code == -1){
          this.$message({showClose: true, message: res.data.msg, type: 'error'})
        }else{
          this.$message({showClose: true, message: '发送成功', type: 'success'})
          this.title = ''
          this.content = ''
        }
        console.debug(myres)
      }).catch(err => {
        console.debug(err)
        this.$message({showClose: true, message: '系统错误', type: 'error'})
      })
    },
  }
}
</script>

<style scoped>
.sysinfo_wrapper{
  padding: 1px;
}
.title_wrapper{
  /* box-shadow:  0 0 5px red; */
  margin: 30px;
  padding: 1px;
}
.content_wrapper{
  /* box-shadow: 0 0 5px red; */
  margin: 30px;
}
.btn_wrapper{
  /* box-shadow: 0 0 5px red; */
  margin: 30px;
  display: flex;
}
.el-button{
  width: 100%;
  margin: auto auto;
}
</style>

<style>

</style>